#!/bin/bash
#
# Settings courtesy of fLa.
# -----------------------------------------------------------------------------------------------------------------   
# x seconds AVERAGE is saved in y time:   
# 2s 1month,   6s 3months,   30s 1year,   1min 5years,   5 min 70years = 105MB data
#
# MAX och MIN under 20sec sparas 1month  =   MB  RRA:MIN:0.5:20:133920 RRA:MAX:0.5:20:133920
# MAX och MIN under 1min  sparas 1year   =  8MB  RRA:MIN:0.5:60:527040 RRA:MAX:0.5:60:527040
# MAX och MIN under 5min  sparas 5years  =  8MB  RRA:MIN:0.5:300:527040 RRA:MAX:0.5:300:527040
# MAX och MIN under 15min sparas 70years = 38MB  RRA:MIN:0.5:900:2459520 RRA:MAX:0.5:900:2459520
# Total 161MB data in RRD
#

rrdtool create 'energy.rrd' \
--start +1sec \
--step 1 \
DS:Watt:GAUGE:10:0:30000 \ 
RRA:AVERAGE:0.5:2:1339200 \
RRA:AVERAGE:0.5:6:1339200 \ 
RRA:AVERAGE:0.5:30:1054080 \
RRA:AVERAGE:0.5:60:2635200 \
RRA:AVERAGE:0.5:300:7378560 \
RRA:MIN:0.5:20:133920 \
RRA:MAX:0.5:20:133920 \
RRA:MIN:0.5:60:527040 \ 
RRA:MAX:0.5:60:527040 \
RRA:MIN:0.5:300:527040 \
RRA:MAX:0.5:300:527040 \
RRA:MIN:0.5:900:2459520 \
RRA:MAX:0.5:900:2459520

